<template>
    <div>
        <van-nav-bar left-text="" left-arrow @click-left="router.go(-1)" />

        <van-search v-model="value" placeholder="请输入搜索关键词" />

        <van-pull-refresh v-model="loading" @refresh="onRefresh">
            <van-grid :border="false" :column-num="2">
                <van-grid-item v-for="(v, i) in cart" :key="i">
                    <van-image
                        :src="v.goods_small_logo ? v.goods_small_logo : 'https://fastly.jsdelivr.net/npm/@vant/assets/apple-1.jpeg'" />
                    {{ v.goods_name }}
                </van-grid-item>
            </van-grid>
        </van-pull-refresh>
    </div>
</template>

<script setup>
import { ref } from 'vue';
import { useRoute, useRouter } from 'vue-router'
const router = useRouter()
const route = useRoute()
import { searchApi } from '@/api/api';

let value = ref(route.query.name)
let cart = ref([])
const getcart = () => {
    searchApi(value.value).then((res) => {
        console.log(res);
        cart.value = res.data.message.goods
    })
}
getcart()


</script>

<style lang="scss" scoped></style>